package com.ddl.common.enums;

/**
 * @author junqiang.wang
 * @ClassName ResultType
 * @Description 返回结果码
 * @Company: www.eloancn.com
 * @date 2016/9/21 15:08
 */

public enum ResultType {


    SUCCESS("S","成功"),
    PROCESSING("P","处理中"),
    FAILED("E","失败"),
    UNKNOWN("N","未知"),//仅适用于交易状态查询系统内部异常时返回
    UNDO("U","未执行"),
    ;
    private String code;
    private String msg;
    
    ResultType(String code, String msg) {
        this.code=code;
        this.msg=msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }
    public String getWithdrawMsg() {
        if(code.equals(SUCCESS.getCode())||code.equals(FAILED.getCode())) {return "提现"+msg;}
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ResultType getResultType(String code) {
        for (ResultType t : ResultType.values()) {
            if (code.equals(t.getCode())) {
                return t;
            }
        }
        return null;
    }
}
